function MainPage() {
	var _self = this;
	var _pageLayout = null;

	_self.onContentLoaded = function() {
		_adjustPageLayout();
		_attachEvents();
	};

	var _attachEvents = function() {
		jQuery(".loginInfo").delegate("#loginBtn", "click", _doLogin);
	};

	// adjust the index page layout
	var _adjustPageLayout = function() {
		_pageLayout = jQuery("body").layout({
			defaults : {
				applyDefaultStyles : false,
				spacing_open : 2,
				resizable : false,
				closable : false
			},
			north : {
				size : 100
			}
		});
	};

	var _doLogin = function() {

		var params = {
			accname : "hyy",
			accpwd : "123"
		};

		params = JSON.stringify(params);
		
		//params = '[{"father":{"name":"Father1","age":30},"mother":{"name":"Mother1","age":28},"children":[{"name":"Child1","age":6},{"name":"Child2","age":6}],"dogs":{"Dog2":{"name":"Dog2","age":5,"color":"Black"},"Dog1":{"name":"Dog1","age":3,"color":"yellow"}}},{"father":{"name":"Father1","age":30},"mother":{"name":"Mother1","age":28},"children":[{"name":"Child1","age":6},{"name":"Child2","age":6}],"dogs":{"Dog2":{"name":"Dog2","age":5,"color":"Black"},"Dog1":{"name":"Dog1","age":3,"color":"yellow"}}}]';
		params = '{"father":{"name":"Father1","age":30},"mother":{"name":"Mother1","age":28},"children":[{"name":"Child1","age":6},{"name":"Child2","age":6}],"dogs":{"Dog2":{"name":"Dog2","age":5,"color":"Black"},"Dog1":{"name":"Dog1","age":3,"color":"yellow"}}}';
		
		jQuery.ajax({
			url : "lab/jsonIn",
			type : "post",
			contentType: "application/json",
			data : params,
			dataType : "json",
			success : function(data) {
				alert(data);
//				if (data.ok == false) {
//					alert(data.errorDesc);
//					return;
//				} else {
//					window.jsessionid = data.jsessionid;
//					me.doLogin();
//				}
			}
		});
	};

}

jQuery(document).ready(function() {
	// alert("ss");
	var mainPage = new MainPage();
	mainPage.onContentLoaded();
});